#include <iostream>
#include <opencv2/opencv.hpp>
#include "CxPort\CxBuffer.hpp"

using namespace std;

void	thread_One(CxCircularBuffer<int > &buffer)
{
	int  i=0;
	while(1)
	{
		boost::this_thread::sleep(boost::posix_time::seconds(2));
		cout<<"Now push the "<<++i<<endl;
		buffer.Push(i);
	}
}

void	thread_Two(CxCircularBuffer<int > &buffer)
{
	while(1)
	{
		boost::this_thread::sleep(boost::posix_time::seconds(1));
		cout<<"Now pop the "<<buffer.Pop()<<endl;
	}
}


int main()
{
	CxCircularBuffer<int > buffer;

	boost::thread(thread_One,boost::ref(buffer));
	boost::thread(thread_Two,boost::ref(buffer));

	boost::this_thread::sleep(boost::posix_time::seconds(1000));
	return 0;
}